import request from '@/utils/request'

export default {
  //角色管理
  roleList() {
    return request({
      url: '/role/list',
      method: 'post',
    })
  },
  rolevalidList() {
    return request({
      url: '/role/validList',
      method: 'post',
    })
  },
  menuList() {
    return request({
      url: '/role/permissions',
      method: 'get',
    })
  },
  roleDetail(id) {
    return request({
      url: `/role/${id}`,
      method: 'GET',
    })
  },
  roleStatus(data) {

    return request({
      url: `/role/${data.id}/status/${data.status}`,
      method: 'post',
    })
  },
  addRole(data) {

    return request({
      url: '/role',
      method: 'post',
      data
    })
  },
  editRole(data) {

    return request({
      url: '/role',
      method: 'put',
      data
    })
  },

  //员工管理
  staffList(data) {
    return request({
      url: '/admin/page',
      method: 'post',
      data
    })
  },
  staffDetail(id) {
    return request({
      url: `/admin/${id}`,
      method: 'GET',
    })
  },
  addStaff(data) {
    return request({
      url: '/admin',
      method: 'post',
      data
    })
  },
  editAdmin(data) {
    return request({
      url: '/admin',
      method: 'put',
      data
    })
  },
  staffStatus(data) {

    return request({
      url: `/admin/${data.id}/status/${data.status}`,
      method: 'post',
    })
  },
  staffPsd(data) {

    return request({
      url: '/admin/changePassword',
      method: 'post',
      data
    })
  },
  //用户管理
  userListTable(data) {
    return request({
      url: '/user/page',
      method: 'post',
      data
    })
  },
  //用户详情
  userDetail(id) {
    return request({
      url: `/user/${id}`,
      method: 'GET',
    })
  },
  editywy(data) {
    return request({
      url: `/user/${data.id}/business/${data.businessAdminId}`,
      method: 'post',
    })
  },
  edittc(data) {
    return request({
      url: '/user/currentPlan',
      method: 'post',
      data
    })
  },
  getType(){
    return request({
      url: '/userModuleUsageTime/toEModuleLimitTypeList',
      method: 'GET',
    })
  },
  userRecord(data){
    return request({
      url: `/userModuleUsageTime/${data.id}/detail/${data.date}`,
      method: 'post',
    })
  },
  editRecord(data){
    return request({
      url: '/userModuleUsageTime',
      method: 'PUT',
      data
    })
  },
  
  changePhone(data) {

    return request({
      url: `/user/${data.id}/check_phone_exist/${data.phone}`,
      method: 'post',
    })
  },
  editStaff(data) {
    return request({
      url: '/user',
      method: 'put',
      data
    })
  },
  userStatus(data) {
    console.log(data);
    return request({
      url: `/user/${data.id}/status/${data.status}`,
      method: 'post',
    })
  },
  userAudit(data) {
    return request({
      url: `/user/${data.id}/audit/${data.audit}`,
      method: 'post',
    })
  },
  // 系统设置
  setDetail() {
    return request({
      url: `/setting/isShowCommunity`,
      method: 'GET',
    })
  },
  setEdit(data) {
    return request({
      url: `/setting/setShowCommunity/${data}`,
      method: 'post',
    })
  },
  uploadImgs(data,onUploadProgress) {
    return request({
      url: '/file/upload',
      method: 'post',
      data,
      onUploadProgress
    })
  },
  uploadFile(data) {
    return request({
      url: '/file/upload',
      method: 'post',
      data,
      responseType:'blob'
      
    })
  },
  download(data) {
    return request({
      url: `/file/download/${data}`,
      method: 'GET',
      responseType:'blob'
    })
  },
  modifyPassword(data) {
    return request({
      url:'/admin/modifyPassword',
      method: 'post',
      data
    })
  },
  getSalesmans() {
    return request({
      url: `/admin/salesmans`,
      method: 'GET',
    })
  },
  
  

}
